package ngamejava2;

import java.io.IOException;

public class MovingTiledBackgroundPlane extends TiledBackgroundPlane
{
	private float speed;

	public MovingTiledBackgroundPlane()
	{
		this(1, 0, "");
	}

	public MovingTiledBackgroundPlane(float distance, float speed, String bgFileName)
	{
		super(distance, bgFileName);
		this.speed = speed;
	}

	@Override
	public void update(long currentTick)
	{
		setOffsetLeft(getOffsetLeft()+speed);
		super.update(currentTick);
	}

	@Override
	public void write(GameWriter gw) throws IOException
	{
		super.write(gw);
		gw.write("speed", speed);
	}
}